#include <iostream>
#include <mutex>
#include <thread>

using namespace std;

class ThreadClass
{
public:
	ThreadClass();
	~ThreadClass();

private:
	void show();

private:
	//thread thread_;
	unique_ptr<thread> thread_;

};

ThreadClass::ThreadClass()
	: thread_(new thread(&ThreadClass::show, this))
{
}

ThreadClass::~ThreadClass()
{
	if (thread_ && thread_->joinable())
		thread_->join();
}

// 注意：类函数如果被线程调用是不能够重载的；
// 否则std::thread对象无法区分函数名而报错
void ThreadClass::show() {
	while (true)
	{
		cout << "the thread is running!" << endl;
	}
	
	
}

int main() {
	ThreadClass thread_class;
	
	return 0;
}
